﻿using DDLParser.model;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace TestParser
{
    class Program
    {
        static void Main(string[] args)
        {
            StreamReader fileStream = null;
            string file = @"C:/Billing.sql";
            try
            {
                if (!File.Exists(file))
                {
                    Console.WriteLine("Error : DDL file not found.");
                    return;
                }
                fileStream = new StreamReader(file);
                DDLParser.DDLParser parser = new DDLParser.DDLParser();
                DDLParser.DDLParserDto dto = new DDLParser.DDLParserDto();

                dto.Stream = fileStream;
                dto.Format = 1;
                ActionResultDto<List<ClassSchema>> result = parser.Parse(dto);
                if (!result.Status)
                {
                    Console.WriteLine("Call Parser Error : " + result.ErrorMessage);
                }
                //else
                //{
                //    foreach (var list in result)
                //    {

                //    }
                //}
            }
            catch (Exception ex)
            {
                Console.WriteLine("Error : " + ex.Message);
            }
            if (fileStream != null)
            {
                fileStream.Close();
                fileStream.Dispose();
            }

            Console.ReadLine();
            return;
        }
    }
}
